| #procedures.py |
| proOne() |
| #procedures.py |
| proOne() |
| 1 | #procedures.py |
| 2 | proOne() |
| proOne() |
| proOne() |
| 1 | proOne() |
| 2 | proOne() |
| proOne() |
| proOne() |
| proTwo() |
| 1 | proOne() |
| 2 | proTwo() |
| 3 | proOne() |
| printDashes() |
| #main.py |
| def printDashes(): |
| proOne() |
| printDashes() |
| print("------------------------------") |
| #procedures.py |
| printDashes() |
| #main.py |
| def printDashes(): |
| proOne() |
| printDashes() |
|     print("------------------------------") |
| #procedures.py |
| 1 | #procedures.py |
| 2 | def printDashes(): |
| 3 |     print("------------------------------") |
| 4 | #main.py |
| 5 | printDashes() |
| 6 | proOne() |
| 7 | printDashes() |
| 8 |      |
| print("Seals can sleep underwater!") |
| printTitle("Seals") |
| 1 | printTitle("Seals") |
| 2 | print("Seals can sleep underwater!") |
| print() |
| print("Sea lions can clap loudly") |
| print("Humpback whales are famous for their songs") |
| printTitle("Sea Lions") |
| printTitle("Whales") |
| 1 | printTitle("Sea Lions") |
| 2 | print("Sea lions can clap loudly") |
| 3 | print() |
| 4 | printTitle("Whales") |
| 5 | print("Humpback whales are famous for their songs") |
| printTitle("Whales","Humpback whales are famous for their songs") |
| printTitle("Sea Lions","Sea lions can clap loudly") |
| 1 | printTitle("Sea Lions","Sea lions can clap loudly") |
| 2 | printTitle("Whales","Humpback whales are famous for their songs") |
| divideFive(5) |
| divideFive(10) |
| divideFive(25) |
| 1 | divideFive(25) |
| 2 | divideFive(10) |
| 3 | divideFive(5) |
| print(a) |
| maths(5) |
| #procedures.py |
| #main.py |
| def maths(a): |
| a = a + 5 |
|     print(a) |
| maths(5) |
| #procedures.py |
| #main.py |
| def maths(a): |
|     a = a + 5 |
| 1 | #procedures.py |
| 2 | def maths(a): |
| 3 |     a = a + 5 |
| 4 |     print(a) |
| 5 |      |
| 6 | #main.py |
| 7 | maths(5) |
| doMaths(3,4) |
| 1 | doMaths(3,4) |
| doMaths(6,2) |
| 1 | doMaths(6,2) |
| #main.py |
| c = a + b |
| print(c) |
| add(7,5) |
| add(1,11) |
| add(6,6) |
| #procedures.py |
| def add(a,b): |
| add(2,10) |
| #main.py |
|     c = a + b |
|     print(c) |
| add(7,5) |
| add(1,11) |
| add(6,6) |
| #procedures.py |
| def add(a,b): |
| add(2,10) |
| 1 | #procedures.py |
| 2 | def add(a,b): |
| 3 |     c = a + b |
| 4 |     print(c) |
| 5 | |
| 6 | #main.py |
| 7 | add(2,10) |
| 8 | add(6,6) |
| 9 | add(1,11) |
| 10 | add(7,5) |
| def loop(): |
| for x in range(5): |
| loop() |
| print("loop") |
| #procedures.py |
| #main.py |
| def loop(): |
|     for x in range(5): |
| loop() |
|         print("loop") |
| #procedures.py |
| #main.py |
| 1 | #procedures.py |
| 2 | def loop(): |
| 3 |     for x in range(5): |
| 4 |         print("loop") |
| 5 | #main.py |
| 6 | loop() |
| def loop(a): |
| loop(5) |
| print("loop") |
| #procedures.py |
| loop(2) |
| for x in range(a): |
| print() |
| #main.py |
| def loop(a): |
| loop(5) |
|         print("loop") |
| #procedures.py |
| loop(2) |
|     for x in range(a): |
| print() |
| #main.py |
| 1 | #procedures.py |
| 2 | def loop(a): |
| 3 |     for x in range(a): |
| 4 |         print("loop") |
| 5 | #main.py |
| 6 | loop(2) |
| 7 | print() |
| 8 | loop(5) |
| #main.py |
| a = int(a) |
| roundNum(2.0) |
| def roundNum(a): |
| a = a + 0.5 |
| roundNum(2.1) |
| roundNum(2.5) |
| roundNum(2.4) |
| roundNum(2.6) |
| #procedures.py |
| roundNum(2.8) |
| print(a) |
| #main.py |
|     a = int(a) |
| roundNum(2.0) |
| def roundNum(a): |
|     a = a + 0.5 |
| roundNum(2.1) |
| roundNum(2.5) |
| roundNum(2.4) |
| roundNum(2.6) |
| #procedures.py |
| roundNum(2.8) |
|     print(a) |
| 1 | #procedures.py |
| 2 | def roundNum(a): |
| 3 |     a = a + 0.5 |
| 4 |     a = int(a) |
| 5 |     print(a) |
| 6 | |
| 7 | #main.py |
| 8 | roundNum(2.0) |
| 9 | roundNum(2.1) |
| 10 | roundNum(2.4) |
| 11 | roundNum(2.5) |
| 12 | roundNum(2.6) |
| 13 | roundNum(2.8) |
| print("1") |
| time.sleep(1) |
| countdown() |
| #procedures.py |
| #main.py |
| time.sleep(1) |
| time.sleep(1) |
| import time |
| def countdown(): |
| print("Go!") |
| print("2") |
| print("3") |
|     print("1") |
|     time.sleep(1) |
| countdown() |
| #procedures.py |
| #main.py |
|     time.sleep(1) |
|     time.sleep(1) |
| import time |
| def countdown(): |
|     print("Go!") |
|     print("2") |
|     print("3") |
| 1 | #procedures.py |
| 2 | import time |
| 3 | |
| 4 | def countdown(): |
| 5 |     print("3") |
| 6 |     time.sleep(1) |
| 7 |     print("2") |
| 8 |     time.sleep(1) |
| 9 |     print("1") |
| 10 |     time.sleep(1) |
| 11 |     print("Go!") |
| 12 | |
| 13 | #main.py |
| 14 | countdown() |
| for x in range(1,a+1): |
| def printNums(a): |
| printNums(10) |
| #procedures.py |
| #main.py |
| printNums(5) |
| print(x) |
|     for x in range(1,a+1): |
| def printNums(a): |
| printNums(10) |
| #procedures.py |
| #main.py |
| printNums(5) |
|         print(x) |
| 1 | #procedures.py |
| 2 | def printNums(a): |
| 3 |     for x in range(1,a+1): |
| 4 |         print(x) |
| 5 | |
| 6 | #main.py |
| 7 | printNums(5) |
| 8 | printNums(10) |
| printNums(30) |
| printNums(20) |
| printNums(10) |
| #main.py |
| 1 | #main.py |
| 2 | printNums(10) |
| 3 | printNums(20) |
| 4 | printNums(30) |
| printNumRow(7) |
| if x == a: #The last index |
| #procedures.py |
| for x in range(1,a+1): |
| def printNumRow(a): |
| e = e + str(x) |
| print(e) |
| else: |
| e = e + str(x) + "," |
| #main.py |
| e = "" |
| printNumRow(7) |
|         if x == a: #The last index |
| #procedures.py |
|     for x in range(1,a+1): |
| def printNumRow(a): |
|             e = e + str(x) |
|     print(e) |
|         else: |
|             e = e + str(x) + "," |
| #main.py |
|     e = "" |
| 1 | #procedures.py |
| 2 | def printNumRow(a): |
| 3 |     e = "" |
| 4 |     for x in range(1,a+1): |
| 5 |         if x == a: #The last index |
| 6 |             e = e + str(x) |
| 7 |         else: |
| 8 |             e = e + str(x) + "," |
| 9 |     print(e) |
| 10 | #main.py |
| 11 | printNumRow(7) |
| #main.py |
| for y in range(b): |
| def printSquare(a,b): |
| print() |
| for x in range(a): |
| s = s + "#" |
| print(s) |
| printSquare(3,3) |
| printSquare(2,2) |
| #procedures.py |
| s = "" |
| printSquare(4,4) |
| print() |
| #main.py |
|     for y in range(b): |
| def printSquare(a,b): |
| print() |
|     for x in range(a): |
|         s = s + "#" |
|         print(s) |
| printSquare(3,3) |
| printSquare(2,2) |
| #procedures.py |
|     s = "" |
| printSquare(4,4) |
| print() |
| 1 | #procedures.py |
| 2 | def printSquare(a,b): |
| 3 |     s = "" |
| 4 |     for x in range(a): |
| 5 |         s = s + "#" |
| 6 |     for y in range(b): |
| 7 |         print(s) |
| 8 | |
| 9 | #main.py |
| 10 | printSquare(2,2) |
| 11 | print() |
| 12 | printSquare(3,3) |
| 13 | print() |
| 14 | printSquare(4,4) |
| print(str(num) + " of" + suit) |
| elif num == 11: |
| suit = a[1] |
| #procedures.py |
| print("Ace of " + suit) |
| #main.py |
| print("Queen of " + suit) |
| print("Jack of " + suit) |
| print("King of " + suit) |
| if num == 1: |
| printCard([4,"Hearts"]) |
| elif num == 13: |
| printCard([1,"Spades"]) |
| num = a[0] |
| def printCard(a): |
| else: |
| elif num == 12: |
|         print(str(num) + " of" + suit) |
|     elif num == 11: |
|     suit = a[1] |
| #procedures.py |
|         print("Ace of " + suit) |
| #main.py |
|         print("Queen of " + suit) |
|         print("Jack of " + suit) |
|         print("King of " + suit) |
|     if num == 1: |
| printCard([4,"Hearts"]) |
|     elif num == 13: |
| printCard([1,"Spades"]) |
|     num = a[0] |
| def printCard(a): |
|     else: |
|     elif num == 12: |
| 1 | #procedures.py |
| 2 | def printCard(a): |
| 3 |     num = a[0] |
| 4 |     suit = a[1] |
| 5 |     if num == 1: |
| 6 |         print("Ace of " + suit) |
| 7 |     elif num == 11: |
| 8 |         print("Jack of " + suit) |
| 9 |     elif num == 12: |
| 10 |         print("Queen of " + suit) |
| 11 |     elif num == 13: |
| 12 |         print("King of " + suit) |
| 13 |     else: |
| 14 |         print(str(num) + " of" + suit) |
| 15 | |
| 16 | #main.py |
| 17 | printCard([4,"Hearts"]) |
| 18 | printCard([1,"Spades"]) |
| printCard(cards[x]) |
| #main.py |
| cards = [[1, "Spades"], [2, "Spades"], [3, "Hearts"], [4, "Hearts"], [5, "Diamonds"], [6, "Diamonds"], [7, "Clubs"], [8, "Clubs"], [9, "Spades"], [10, "Hearts"]] |
| for x in range(len(cards)): |
|     printCard(cards[x]) |
| #main.py |
| cards = [[1, "Spades"], [2, "Spades"], [3, "Hearts"], [4, "Hearts"], [5, "Diamonds"], [6, "Diamonds"], [7, "Clubs"], [8, "Clubs"], [9, "Spades"], [10, "Hearts"]] |
| for x in range(len(cards)): |
| 1 | #main.py |
| 2 | cards = [[1, "Spades"], [2, "Spades"], [3, "Hearts"], [4, "Hearts"], [5, "Diamonds"], [6, "Diamonds"], [7, "Clubs"], [8, "Clubs"], [9, "Spades"], [10, "Hearts"]] |
| 3 | for x in range(len(cards)): |
| 4 |     printCard(cards[x]) |
| 5 |      |
| printTogether(["A","B","C"],[1,2,3]) |
| def printTogether(a,b): |
| #procedures.py |
| #main.py |
| print(str(a[x]) + " = " + str(b[x])) |
| for x in range(len(a)): |
| printTogether(["A","B","C"],[1,2,3]) |
| def printTogether(a,b): |
| #procedures.py |
| #main.py |
|         print(str(a[x]) + " = " + str(b[x])) |
|     for x in range(len(a)): |
| 1 | #procedures.py |
| 2 | def printTogether(a,b): |
| 3 |     for x in range(len(a)): |
| 4 |         print(str(a[x]) + " = " + str(b[x])) |
| 5 |          |
| 6 | #main.py |
| 7 | printTogether(["A","B","C"],[1,2,3]) |
| t = t * x |
| f = False |
| print(n*n) |
| for x in range(n): |
| def factorial(n): |
| print(f) |
| #procedures.py |
| def absolute(n): |
| t = 1 |
| def square(n): |
| print(n) |
| for x in range(n): |
| n = n * -1 |
| f = True |
| if x * x == n: |
| print(t) |
| if n < 0: |
| def isSquared(n): |
|         t = t * x |
|     f = False |
|     print(n*n) |
|     for x in range(n): |
| def factorial(n): |
|     print(f) |
| #procedures.py |
| def absolute(n): |
|     t = 1 |
| def square(n): |
|     print(n) |
|     for x in range(n): |
|         n = n * -1 |
|             f = True |
|         if x * x == n: |
|     print(t) |
|     if n < 0: |
| def isSquared(n): |
| 1 | #procedures.py |
| 2 | def square(n): |
| 3 |     print(n*n) |
| 4 | |
| 5 | def factorial(n): |
| 6 |     t = 1 |
| 7 |     for x in range(n): |
| 8 |         t = t * x |
| 9 |     print(t) |
| 10 | |
| 11 | def isSquared(n): |
| 12 |     f = False |
| 13 |     for x in range(n): |
| 14 |         if x * x == n: |
| 15 |             f = True |
| 16 |     print(f) |
| 17 | |
| 18 | def absolute(n): |
| 19 |     if n < 0: |
| 20 |         n = n * -1 |
| 21 |     print(n) |
| f = True |
| print(fib[:n]) |
| #procedures.py |
| def fibonacci(n): |
| for x in range(n): |
| print(f) |
| f = False |
| i1 = len(fib) - 1 |
| for x in range(n-2): |
| def isPrime(n): |
| fib.append(fib[i1] + fib[i2]) |
| if n % x == 0: |
| i2 = len(fib) - 2 |
| fib = [1,1] |
|     f = True |
|     print(fib[:n]) |
| #procedures.py |
| def fibonacci(n): |
|     for x in range(n): |
|     print(f) |
|             f = False |
|         i1 = len(fib) - 1 |
|     for x in range(n-2): |
| def isPrime(n): |
|         fib.append(fib[i1] + fib[i2]) |
|         if n % x == 0: |
|         i2 = len(fib) - 2 |
|     fib = [1,1] |
| 1 | #procedures.py |
| 2 | def fibonacci(n): |
| 3 |     fib = [1,1] |
| 4 |     for x in range(n-2): |
| 5 |         i1 = len(fib) - 1 |
| 6 |         i2 = len(fib) - 2 |
| 7 |         fib.append(fib[i1] + fib[i2]) |
| 8 |     print(fib[:n]) |
| 9 |      |
| 10 | def isPrime(n): |
| 11 |     f = True |
| 12 |     for x in range(n): |
| 13 |         if n % x == 0: |
| 14 |             f = False |
| 15 |     print(f) |
| 16 |      |
| break |
| print("Enter a command you wish to execute:") |
| num = input() |
| absolute(num) |
| #main.py |
| elif command == "absolute": |
| square(num) |
| elif command == "isSquared": |
| elif command == "factorial": |
| factorial(num) |
| command = input() |
| isSquared(num) |
| while True: |
| if command == "square": |
| elif command == "exit": |
| print("square,factorial,isSquared,absolute") |
| print("Enter a number to apply it to") |
|         break |
|     print("Enter a command you wish to execute:") |
|     num = input() |
|         absolute(num) |
| #main.py |
|     elif command == "absolute": |
|         square(num) |
|     elif command == "isSquared": |
|     elif command == "factorial": |
|         factorial(num) |
|     command = input() |
|         isSquared(num) |
| while True: |
|     if command == "square": |
|     elif command == "exit": |
|     print("square,factorial,isSquared,absolute") |
|     print("Enter a number to apply it to") |
| 1 | #main.py |
| 2 | while True: |
| 3 |     print("Enter a command you wish to execute:") |
| 4 |     print("square,factorial,isSquared,absolute") |
| 5 |     command = input() |
| 6 |     print("Enter a number to apply it to") |
| 7 |     num = input() |
| 8 |     if command == "square": |
| 9 |         square(num) |
| 10 |     elif command == "factorial": |
| 11 |         factorial(num) |
| 12 |     elif command == "isSquared": |
| 13 |         isSquared(num) |
| 14 |     elif command == "absolute": |
| 15 |         absolute(num) |
| 16 |     elif command == "exit": |
| 17 |         break |
| e = e + str(arr[x]) + s |
| def printArray(arr,s): |
| printArray(wordList,",") |
| #main.py |
| e = "" |
| printArray(wordList," ") |
| for x in range(len(arr)): |
| wordList = ["apple", "banana", "cherry", "date", "elderberry"] |
| printArray(numberList,",") |
| printArray(numberList," ") |
| numberList = [23, 87, 5, 42, 91, 14, 68, 77, 3, 56] |
| print(e[:len(e)-len(s)]) #removes the last , |
| #procedures.py |
| printArray(wordList," | ") |
| printArray(numberList," | ") |
|         e = e + str(arr[x]) + s |
| def printArray(arr,s): |
| printArray(wordList,",") |
| #main.py |
|     e = "" |
| printArray(wordList," ") |
|     for x in range(len(arr)): |
| wordList = ["apple", "banana", "cherry", "date", "elderberry"] |
| printArray(numberList,",") |
| printArray(numberList," ") |
| numberList = [23, 87, 5, 42, 91, 14, 68, 77, 3, 56] |
|     print(e[:len(e)-len(s)]) #removes the last , |
| #procedures.py |
| printArray(wordList," | ") |
| printArray(numberList," | ") |
| 1 | #procedures.py |
| 2 | def printArray(arr,s): |
| 3 |     e = "" |
| 4 |     for x in range(len(arr)): |
| 5 |         e = e + str(arr[x]) + s |
| 6 |     print(e[:len(e)-len(s)]) #removes the last , |
| 7 | |
| 8 | #main.py |
| 9 | wordList = ["apple", "banana", "cherry", "date", "elderberry"] |
| 10 | numberList = [23, 87, 5, 42, 91, 14, 68, 77, 3, 56] |
| 11 | printArray(wordList," ") |
| 12 | printArray(numberList," ") |
| 13 | printArray(wordList,",") |
| 14 | printArray(numberList,",") |
| 15 | printArray(wordList," | ") |
| 16 | printArray(numberList," | ") |
| sentence = sentence + text[x] + " " |
| wordWrap("This is a program that uses procedures to display stuff on the screen") |
| else: |
| sentence = text[x] + " " |
| #main.py |
| sentence = "" |
| print(sentence) |
| def wordWrap(s): |
| print(sentence) |
| #procedures.py |
| if len(sentence) + len(text[x]) > 25: |
| text = s.split(" ") |
| for x in range(len(text)): |
|             sentence = sentence + text[x] + " " |
| wordWrap("This is a program that uses procedures to display stuff on the screen") |
|         else: |
|             sentence = text[x] + " " |
| #main.py |
|     sentence = "" |
|     print(sentence) |
| def wordWrap(s): |
|             print(sentence) |
| #procedures.py |
|         if len(sentence) + len(text[x]) > 25: |
|     text = s.split(" ") |
|     for x in range(len(text)): |
| 1 | #procedures.py |
| 2 | def wordWrap(s): |
| 3 |     text = s.split(" ") |
| 4 |     sentence = "" |
| 5 |     for x in range(len(text)): |
| 6 |         if len(sentence) + len(text[x]) > 25: |
| 7 |             print(sentence) |
| 8 |             sentence = text[x] + " " |
| 9 |         else: |
| 10 |             sentence = sentence + text[x] + " " |
| 11 |     print(sentence) |
| 12 | #main.py |
| 13 | wordWrap("This is a program that uses procedures to display stuff on the screen") |
| items.append(arr[x]) |
| for x in range(len(arr)): |
| summaryArr(["bread","apple","apple","lemon"]) |
| #procedures.py |
| if arr[x] not in items: |
| items = [] |
| #main.py |
| else: |
| print(items[x] + ": " + str(count[x])) |
| def summaryArr(arr): |
| i = items.index(arr[x]) |
| for x in range(len(items)): |
| count.append(1) |
| count = [] |
| count[i] = count[i] + 1 |
|             items.append(arr[x]) |
|     for x in range(len(arr)): |
| summaryArr(["bread","apple","apple","lemon"]) |
| #procedures.py |
|         if arr[x] not in items: |
|     items = [] |
| #main.py |
|         else: |
|         print(items[x] + ": " + str(count[x])) |
| def summaryArr(arr): |
|             i = items.index(arr[x]) |
|     for x in range(len(items)): |
|             count.append(1) |
|     count = [] |
|             count[i] = count[i] + 1 |
| 1 | #procedures.py |
| 2 | def summaryArr(arr): |
| 3 |     items = [] |
| 4 |     count = [] |
| 5 |     for x in range(len(arr)): |
| 6 |         if arr[x] not in items: |
| 7 |             items.append(arr[x]) |
| 8 |             count.append(1) |
| 9 |         else: |
| 10 |             i = items.index(arr[x]) |
| 11 |             count[i] = count[i] + 1 |
| 12 |     for x in range(len(items)): |
| 13 |         print(items[x] + ": " + str(count[x])) |
| 14 | #main.py |
| 15 | summaryArr(["bread","apple","apple","lemon"]) |
| printDown(5) |
| if a != 0: |
| printDown(a-1) |
| print(a) |
| printDown(8) |
| def printDown(a): |
| printDown(5) |
|     if a != 0: |
|         printDown(a-1) |
|         print(a) |
| printDown(8) |
| def printDown(a): |
| 1 | def printDown(a): |
| 2 |     if a != 0: |
| 3 |         print(a) |
| 4 |         printDown(a-1) |
| 5 | |
| 6 | printDown(8) |
| 7 | printDown(5) |
| def doubleNumber(a,b): |
| if b != 0: |
| a = a * 2 |
| doubleNumber(10,4) |
| print(a) |
| doubleNumber(a,b) |
| b = b - 1 |
| print() |
| doubleNumber(30,2) |
| def doubleNumber(a,b): |
|     if b != 0: |
|         a = a * 2 |
| doubleNumber(10,4) |
|         print(a) |
|         doubleNumber(a,b) |
|         b = b - 1 |
| print() |
| doubleNumber(30,2) |
| 1 | def doubleNumber(a,b): |
| 2 |     if b != 0: |
| 3 |         b = b - 1 |
| 4 |         a = a * 2 |
| 5 |         print(a) |
| 6 |         doubleNumber(a,b) |
| 7 | |
| 8 | doubleNumber(10,4) |
| 9 | print() |
| 10 | doubleNumber(30,2) |
| b = a.pop(0) |
| print() |
| def printArrayItems(a): |
| if len(a) != 0: |
| printArrayItems([3,2,1]) |
| print(b) |
| printArrayItems(a) |
| printArrayItems([1,2,3]) |
|         b = a.pop(0) |
| print() |
| def printArrayItems(a): |
|     if len(a) != 0: |
| printArrayItems([3,2,1]) |
|         print(b) |
|         printArrayItems(a) |
| printArrayItems([1,2,3]) |
| 1 | def printArrayItems(a): |
| 2 |     if len(a) != 0: |
| 3 |         b = a.pop(0) |
| 4 |         print(b) |
| 5 |         printArrayItems(a) |
| 6 | |
| 7 | printArrayItems([1,2,3]) |
| 8 | print() |
| 9 | printArrayItems([3,2,1]) |
| else: |
| a = a + 2 ** power |
| z = b[0] |
| print() |
| print(a) |
| if z == "1": |
| if len(b) > 0: |
| b = b[1:] |
| binaryConvert("11110000") |
| power = len(b) |
| else: |
| def binaryConvert(b,a=0): |
| binaryConvert(b,a) |
| binaryConvert("10101111") |
| binaryConvert(b,a) |
|     else: |
|             a = a + 2 ** power |
|         z = b[0] |
| print() |
|         print(a) |
|         if z == "1": |
|     if len(b) > 0: |
|         b = b[1:] |
| binaryConvert("11110000") |
|             power = len(b) |
|         else: |
| def binaryConvert(b,a=0): |
|             binaryConvert(b,a) |
| binaryConvert("10101111") |
|             binaryConvert(b,a) |
| 1 | def binaryConvert(b,a=0): |
| 2 |     if len(b) > 0: |
| 3 |         z = b[0] |
| 4 |         b = b[1:] |
| 5 |         if z == "1": |
| 6 |             power = len(b) |
| 7 |             a = a + 2 ** power |
| 8 |             binaryConvert(b,a) |
| 9 |         else: |
| 10 |             binaryConvert(b,a) |
| 11 |     else: |
| 12 |         print(a) |
| 13 |          |
| 14 |          |
| 15 |      |
| 16 | binaryConvert("10101111") |
| 17 | print() |
| 18 | binaryConvert("11110000") |
| denaryConvert(div,a) |
| if n != 0: |
| print() |
| else: |
| denaryConvert(175) |
| a = str(rem) + a |
| def denaryConvert(n,a=""): |
| denaryConvert(240) |
| div = n // 2 |
| rem = n % 2 |
| print(a) |
|         denaryConvert(div,a) |
|     if n != 0: |
| print() |
|     else: |
| denaryConvert(175) |
|         a = str(rem) + a |
| def denaryConvert(n,a=""): |
| denaryConvert(240) |
|         div = n // 2 |
|         rem = n % 2 |
|         print(a) |
| 1 | def denaryConvert(n,a=""): |
| 2 |     if n != 0: |
| 3 |         div = n // 2 |
| 4 |         rem = n % 2 |
| 5 |         a = str(rem) + a |
| 6 |         denaryConvert(div,a) |
| 7 |     else: |
| 8 |         print(a) |
| 9 | |
| 10 | denaryConvert(175) |
| 11 | print() |
| 12 | denaryConvert(240) |